Theme and Esri Style loading issue in combobox

183
1
Jump to solution
02-10-2020 07:09 PM
ThanHtetAung_EsriAu
Esri Regular Contributor

Hi Guys,

I got style loading inconsistently in ArcGIS Pro , combobox.

For example that combobox : 

Loaded correctly with the following code.

<ComboBox Background="{DynamicResource Esri_BackgroundPressedBrush}" Foreground="{DynamicResource Esri_TextStyleEmphasisBrush}" IsEditable="False" Grid.Row="0" Grid.Column="1" SelectedValue="{Binding Path=InputModel.Delimiter}" SelectedValuePath="Tag" > 

                <ComboBoxItem Tag=",">Comma</ComboBoxItem> 

                <ComboBoxItem Tag=" ">Space</ComboBoxItem> 

                <ComboBoxItem Tag="  ">MultiSpace</ComboBoxItem> 

                <ComboBoxItem Tag="\t">Tab</ComboBoxItem> 

                <ComboBoxItem Tag=":">Colon</ComboBoxItem> 

                <ComboBoxItem Tag="?">Other</ComboBoxItem> 

            </ComboBox> 

However, If I load dynamically with style edit based on mvvm binding. with same background and foreground style. I got different result.

<ComboBox Background="{DynamicResource Esri_BackgroundPressedBrush}" Foreground="{DynamicResource Esri_TextStyleEmphasisBrush}"  

                      Grid.Row="8" Grid.Column="1" SelectedItem="{Binding Path=InputModel.LongIndex, Mode=TwoWay}" SelectedValuePath="Tag" 

                      ItemsSource="{Binding Path=ColumnCount, Mode=TwoWay}" > 

                <ComboBox.Style> 

                    <Style TargetType="{x:Type ComboBox}"> 

                        <Setter Property="IsEnabled" Value="False"> 

                        </Setter> 

                        <Style.Triggers> 

                            <DataTrigger Binding="{Binding Path=InputModel.DataReady}" Value="True"> 

                                <Setter Property="IsEnabled" Value="True" /> 

                            </DataTrigger> 

                        </Style.Triggers> 

                    </Style> 

                </ComboBox.Style> 

            </ComboBox> 

 

Do I need something to make it work or is that bug?

Best Regards,

Than

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ThanHtetAung_EsriAu
Esri Regular Contributor

Hi Guys,

Managed to get workaround without using style trigger.

I just directly bind with the properties through viewmodel, for those with visibility which is not default string format.

I create the new variable with visibility data type. That way solve for me at the moment.

 <ComboBox Background="{DynamicResource Esri_BackgroundPressedBrush}" Foreground="{DynamicResource Esri_TextStyleEmphasisBrush}" 
                          IsEditable="False" Grid.Row="8" Grid.Column="1" SelectedItem="{Binding Path=BatchUploadModel.LatIndex}"
                          SelectedValuePath="Tag" 
                          ItemsSource="{Binding Path=ColumnCount, Mode=TwoWay}" IsEnabled="{Binding Path=BatchUploadModel.DataReady}">
                        </ComboBox>

View solution in original post

0 Kudos
1 Reply
ThanHtetAung_EsriAu
Esri Regular Contributor

Hi Guys,

Managed to get workaround without using style trigger.

I just directly bind with the properties through viewmodel, for those with visibility which is not default string format.

I create the new variable with visibility data type. That way solve for me at the moment.

 <ComboBox Background="{DynamicResource Esri_BackgroundPressedBrush}" Foreground="{DynamicResource Esri_TextStyleEmphasisBrush}" 
                          IsEditable="False" Grid.Row="8" Grid.Column="1" SelectedItem="{Binding Path=BatchUploadModel.LatIndex}"
                          SelectedValuePath="Tag" 
                          ItemsSource="{Binding Path=ColumnCount, Mode=TwoWay}" IsEnabled="{Binding Path=BatchUploadModel.DataReady}">
                        </ComboBox>
0 Kudos